import React from 'react';
import ReactDOM from 'react-dom';

class WebSite  extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            name:'菜鸟教程',
            site:'https://www.runoob.com',
        }
    }


    render() {
        return(
            <div>
                <Name name={this.state.name}></Name>
                <Link site={this.state.site}></Link>
            </div>
        );
    }
}

class Name extends React.Component{
    render() {
        return (
            <h1> {this.props.name}</h1>
        );
    }
}
class Link extends React.Component {
    render() {
        return (
            <a href={this.props.site}>{this.props.site}</a>
        )
    }
}
ReactDOM.render(
    <WebSite/>,
    document.getElementById('root')
);
